package com.deyuanyun.pic.pbf.controller.dto.defect.node;

import com.deyuanyun.pic.common.util.ObjectUtil;
import com.deyuanyun.pic.common.util.format.NumberFormat;
import com.deyuanyun.pic.pbf.domain.SurfaceTreatment;
import com.deyuanyun.pic.settings.support.biz.CodeUtil;

/**
 * 4,表面处理表
 *
 * @author huanglw
 * @date 2016-6-29
 *
 * History: [修改人][时间][修改描述]
 */
public class SurfaceTreatmentDto extends NodeDto {

    /**
     * 锚纹深度
     */
    private String anchorDepth;

    /**
     * 除锈等级：Sa2.5；St3；Sa3；St2；Sa1；Sa2；F1
     */
    private String derustingGrade;

    /**
     * 是否需要换管：0，不需要；1，需要
     */
    private String isPipeReplacement;

    /**
     * 是否完成该节点任务：0，没有完成；1，已经完成
     */
    private Short isCompletion;

    public SurfaceTreatmentDto(Short isCompletion) {
        this.isCompletion = isCompletion;
    }

    public Short getIsCompletion() {
        return isCompletion;
    }

    public void setIsCompletion(Short isCompletion) {
        this.isCompletion = isCompletion;
    }

    public String getAnchorDepth() {
        return anchorDepth;
    }

    public void setAnchorDepth(String anchorDepth) {
        this.anchorDepth = anchorDepth;
    }

    public String getDerustingGrade() {
        return derustingGrade;
    }

    public void setDerustingGrade(String derustingGrade) {
        this.derustingGrade = derustingGrade;
    }

    public String getIsPipeReplacement() {
        return isPipeReplacement;
    }

    public void setIsPipeReplacement(String isPipeReplacement) {
        this.isPipeReplacement = isPipeReplacement;
    }

    public void fromDomain(SurfaceTreatment domain) {

        if (ObjectUtil.isEmptyAll(domain)) {
            return;
        }

        // 锚纹深度
        this.anchorDepth = NumberFormat.format(domain.getAnchorDepth());
        // 除锈等级
        this.derustingGrade = CodeUtil.getName(domain.getDerustingGrade());
        // 是否需要换管
        this.isPipeReplacement = (domain.getIsPipeReplacement()!=null && domain.getIsPipeReplacement()==1) ? "需要" : "不需要" ;

        // 赋值
        super.fromDomain(domain.getId(), domain.getCreateRemark());
    }
}